import instance from "@/http/index.js"

// 保存登录日志
export const saveLoginLogAPI = (data) => {
  const { account, name, email } = data
  return instance({
    url: '/loginLog/saveLoginLog',
    method: 'post',
    data: {
      account,
      name,
      email
    }
  })
}

// 获取登录日志
export const getLoginLogListAPI = () => {
  return instance({
    url: '/loginLog/getLoginLogList',
    method: 'get'
  })
}

// 搜索最近十条日志
export const getRecentTenLoginLog = (data) => {
  const { account } = data
  return instance({
    url: '/loginLog/getRecentTenLoginLog',
    method: 'post',
    data: {
      account
    }
  })
}

// 获取登录总长度
export const getLoginLogTotalAPI = () => {
  return instance({
    url: '/loginLog/getLoginLogTotal',
    method: 'get'
  })
}


// 根据页码换页 
export const getLoginLogByPagerAPI = (data) => {
  const { pager } = data
  return instance({
    url: '/loginLog/getLoginLogByPager',
    method: 'post',
    data: {
      pager,
    }
  })
}

// 清空所有登录日志
export const clearLoginLogListAPI = () => {
  return instance({
    url: '/loginLog/clearLoginLogList',
    method: 'get'
  })
}